{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "In this example we will take a small set of colors in the RGB space use the intensity values to train a SOM. Ater the som is train we will plot the map coloring each neauron using its weights as RGB coordinates.\n",
    "\n",
    "Let's first define our colors:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from minisom import MiniSom\n",
    "\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "%matplotlib inline\n",
    "\n",
    "%load_ext autoreload\n",
    "\n",
    "#Training inputs for RGBcolors\n",
    "colors = [[0., 0., 0.],\n",
    "      [0., 0., 1.],\n",
    "      [0., 0., 0.5],\n",
    "      [0.125, 0.529, 1.0],\n",
    "      [0.33, 0.4, 0.67],\n",
    "      [0.6, 0.5, 1.0],\n",
    "      [0., 1., 0.],\n",
    "      [1., 0., 0.],\n",
    "      [0., 1., 1.],\n",
    "      [1., 0., 1.],\n",
    "      [1., 1., 0.],\n",
    "      [1., 1., 1.],\n",
    "      [.33, .33, .33],\n",
    "      [.5, .5, .5],\n",
    "      [.66, .66, .66]]\n",
    "color_names = \\\n",
    "    ['black', 'blue', 'darkblue', 'skyblue',\n",
    "     'greyblue', 'lilac', 'green', 'red',\n",
    "     'cyan', 'violet', 'yellow', 'white',\n",
    "     'darkgrey', 'mediumgrey', 'lightgrey']"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Let's initialize our SOM and plot the colors without training:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.image.AxesImage at 0x112c10280>"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAPsAAAD5CAYAAADhukOtAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0c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QluxCeoGQXwhOU7EJ4gpJdCE9QsgvhCf8P8o1/l810lsoAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "som = MiniSom(30, 30, 3, sigma=3., \n",
    "              learning_rate=2.5, \n",
    "              neighborhood_function='gaussian')\n",
    "\n",
    "plt.imshow(abs(som.get_weights()), interpolation='none')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We can now train the SOM and check how the organization of the weights has changed:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\r",
      " [   0 / 500 ]   0% - ? it/s\r",
      " [   0 / 500 ]   0% - ? it/s\r",
      " [   1 / 500 ]   0% - 0:00:00 left \r",
      " [   2 / 500 ]   0% - 0:00:00 left \r",
      " [   3 / 500 ]   1% - 0:00:00 left \r",
      " [   4 / 500 ]   1% - 0:00:00 left \r",
      " [   5 / 500 ]   1% - 0:00:00 left \r",
      " [   6 / 500 ]   1% - 0:00:00 left \r",
      " [   7 / 500 ]   1% - 0:00:00 left \r",
      " [   8 / 500 ]   2% - 0:00:00 left \r",
      " [   9 / 500 ]   2% - 0:00:00 left \r",
      " [  10 / 500 ]   2% - 0:00:00 left \r",
      " [  11 / 500 ]   2% - 0:00:00 left \r",
      " [  12 / 500 ]   2% - 0:00:00 left \r",
      " [  13 / 500 ]   3% - 0:00:00 left \r",
      " [  14 / 500 ]   3% - 0:00:00 left \r",
      " [  15 / 500 ]   3% - 0:00:00 left \r",
      " [  16 / 500 ]   3% - 0:00:00 left \r",
      " [  17 / 500 ]   3% - 0:00:00 left \r",
      " [  18 / 500 ]   4% - 0:00:00 left \r",
      " [  19 / 500 ]   4% - 0:00:00 left \r",
      " [  20 / 500 ]   4% - 0:00:00 left \r",
      " [  21 / 500 ]   4% - 0:00:00 left \r",
      " [  22 / 500 ]   4% - 0:00:00 left \r",
      " [  23 / 500 ]   5% - 0:00:00 left \r",
      " [  24 / 500 ]   5% - 0:00:00 left \r",
      " [  25 / 500 ]   5% - 0:00:00 left \r",
      " [  26 / 500 ]   5% - 0:00:00 left \r",
      " [  27 / 500 ]   5% - 0:00:00 left \r",
      " [  28 / 500 ]   6% - 0:00:00 left \r",
      " [  29 / 500 ]   6% - 0:00:00 left \r",
      " [  30 / 500 ]   6% - 0:00:00 left \r",
      " [  31 / 500 ]   6% - 0:00:00 left \r",
      " [  32 / 500 ]   6% - 0:00:00 left \r",
      " [  33 / 500 ]   7% - 0:00:00 left \r",
      " [  34 / 500 ]   7% - 0:00:00 left \r",
      " [  35 / 500 ]   7% - 0:00:00 left \r",
      " [  36 / 500 ]   7% - 0:00:00 left \r",
      " [  37 / 500 ]   7% - 0:00:00 left \r",
      " [  38 / 500 ]   8% - 0:00:00 left \r",
      " [  39 / 500 ]   8% - 0:00:00 left \r",
      " [  40 / 500 ]   8% - 0:00:00 left \r",
      " [  41 / 500 ]   8% - 0:00:00 left \r",
      " [  42 / 500 ]   8% - 0:00:00 left \r",
      " [  43 / 500 ]   9% - 0:00:00 left \r",
      " [  44 / 500 ]   9% - 0:00:00 left \r",
      " [  45 / 500 ]   9% - 0:00:00 left \r",
      " [  46 / 500 ]   9% - 0:00:00 left \r",
      " [  47 / 500 ]   9% - 0:00:00 left \r",
      " [  48 / 500 ]  10% - 0:00:00 left \r",
      " [  49 / 500 ]  10% - 0:00:00 left \r",
      " [  50 / 500 ]  10% - 0:00:00 left \r",
      " [  51 / 500 ]  10% - 0:00:00 left \r",
      " [  52 / 500 ]  10% - 0:00:00 left \r",
      " [  53 / 500 ]  11% - 0:00:00 left \r",
      " [  54 / 500 ]  11% - 0:00:00 left \r",
      " [  55 / 500 ]  11% - 0:00:00 left \r",
      " [  56 / 500 ]  11% - 0:00:00 left \r",
      " [  57 / 500 ]  11% - 0:00:00 left \r",
      " [  58 / 500 ]  12% - 0:00:00 left \r",
      " [  59 / 500 ]  12% - 0:00:00 left \r",
      " [  60 / 500 ]  12% - 0:00:00 left \r",
      " [  61 / 500 ]  12% - 0:00:00 left \r",
      " [  62 / 500 ]  12% - 0:00:00 left \r",
      " [  63 / 500 ]  13% - 0:00:00 left \r",
      " [  64 / 500 ]  13% - 0:00:00 left \r",
      " [  65 / 500 ]  13% - 0:00:00 left \r",
      " [  66 / 500 ]  13% - 0:00:00 left \r",
      " [  67 / 500 ]  13% - 0:00:00 left \r",
      " [  68 / 500 ]  14% - 0:00:00 left \r",
      " [  69 / 500 ]  14% - 0:00:00 left \r",
      " [  70 / 500 ]  14% - 0:00:00 left \r",
      " [  71 / 500 ]  14% - 0:00:00 left \r",
      " [  72 / 500 ]  14% - 0:00:00 left \r",
      " [  73 / 500 ]  15% - 0:00:00 left \r",
      " [  74 / 500 ]  15% - 0:00:00 left \r",
      " [  75 / 500 ]  15% - 0:00:00 left \r",
      " [  76 / 500 ]  15% - 0:00:00 left \r",
      " [  77 / 500 ]  15% - 0:00:00 left \r",
      " [  78 / 500 ]  16% - 0:00:00 left \r",
      " [  79 / 500 ]  16% - 0:00:00 left \r",
      " [  80 / 500 ]  16% - 0:00:00 left \r",
      " [  81 / 500 ]  16% - 0:00:00 left \r",
      " [  82 / 500 ]  16% - 0:00:00 left \r",
      " [  83 / 500 ]  17% - 0:00:00 left \r",
      " [  84 / 500 ]  17% - 0:00:00 left \r",
      " [  85 / 500 ]  17% - 0:00:00 left \r",
      " [  86 / 500 ]  17% - 0:00:00 left \r",
      " [  87 / 500 ]  17% - 0:00:00 left \r",
      " [  88 / 500 ]  18% - 0:00:00 left \r",
      " [  89 / 500 ]  18% - 0:00:00 left \r",
      " [  90 / 500 ]  18% - 0:00:00 left \r",
      " [  91 / 500 ]  18% - 0:00:00 left \r",
      " [  92 / 500 ]  18% - 0:00:00 left \r",
      " [  93 / 500 ]  19% - 0:00:00 left \r",
      " [  94 / 500 ]  19% - 0:00:00 left \r",
      " [  95 / 500 ]  19% - 0:00:00 left \r",
      " [  96 / 500 ]  19% - 0:00:00 left \r",
      " [  97 / 500 ]  19% - 0:00:00 left \r",
      " [  98 / 500 ]  20% - 0:00:00 left \r",
      " [  99 / 500 ]  20% - 0:00:00 left \r",
      " [ 100 / 500 ]  20% - 0:00:00 left \r",
      " [ 101 / 500 ]  20% - 0:00:00 left \r",
      " [ 102 / 500 ]  20% - 0:00:00 left \r",
      " [ 103 / 500 ]  21% - 0:00:00 left \r",
      " [ 104 / 500 ]  21% - 0:00:00 left \r",
      " [ 105 / 500 ]  21% - 0:00:00 left \r",
      " [ 106 / 500 ]  21% - 0:00:00 left \r",
      " [ 107 / 500 ]  21% - 0:00:00 left \r",
      " [ 108 / 500 ]  22% - 0:00:00 left \r",
      " [ 109 / 500 ]  22% - 0:00:00 left \r",
      " [ 110 / 500 ]  22% - 0:00:00 left \r",
      " [ 111 / 500 ]  22% - 0:00:00 left \r",
      " [ 112 / 500 ]  22% - 0:00:00 left \r",
      " [ 113 / 500 ]  23% - 0:00:00 left \r",
      " [ 114 / 500 ]  23% - 0:00:00 left \r",
      " [ 115 / 500 ]  23% - 0:00:00 left \r",
      " [ 116 / 500 ]  23% - 0:00:00 left \r",
      " [ 117 / 500 ]  23% - 0:00:00 left \r",
      " [ 118 / 500 ]  24% - 0:00:00 left \r",
      " [ 119 / 500 ]  24% - 0:00:00 left \r",
      " [ 120 / 500 ]  24% - 0:00:00 left \r",
      " [ 121 / 500 ]  24% - 0:00:00 left \r",
      " [ 122 / 500 ]  24% - 0:00:00 left \r",
      " [ 123 / 500 ]  25% - 0:00:00 left \r",
      " [ 124 / 500 ]  25% - 0:00:00 left \r",
      " [ 125 / 500 ]  25% - 0:00:00 left \r",
      " [ 126 / 500 ]  25% - 0:00:00 left \r",
      " [ 127 / 500 ]  25% - 0:00:00 left \r",
      " [ 128 / 500 ]  26% - 0:00:00 left \r",
      " [ 129 / 500 ]  26% - 0:00:00 left \r",
      " [ 130 / 500 ]  26% - 0:00:00 left \r",
      " [ 131 / 500 ]  26% - 0:00:00 left \r",
      " [ 132 / 500 ]  26% - 0:00:00 left \r",
      " [ 133 / 500 ]  27% - 0:00:00 left \r",
      " [ 134 / 500 ]  27% - 0:00:00 left \r",
      " [ 135 / 500 ]  27% - 0:00:00 left \r",
      " [ 136 / 500 ]  27% - 0:00:00 left \r",
      " [ 137 / 500 ]  27% - 0:00:00 left \r",
      " [ 138 / 500 ]  28% - 0:00:00 left \r",
      " [ 139 / 500 ]  28% - 0:00:00 left \r",
      " [ 140 / 500 ]  28% - 0:00:00 left \r",
      " [ 141 / 500 ]  28% - 0:00:00 left \r",
      " [ 142 / 500 ]  28% - 0:00:00 left \r",
      " [ 143 / 500 ]  29% - 0:00:00 left \r",
      " [ 144 / 500 ]  29% - 0:00:00 left \r",
      " [ 145 / 500 ]  29% - 0:00:00 left \r",
      " [ 146 / 500 ]  29% - 0:00:00 left \r",
      " [ 147 / 500 ]  29% - 0:00:00 left \r",
      " [ 148 / 500 ]  30% - 0:00:00 left \r",
      " [ 149 / 500 ]  30% - 0:00:00 left \r",
      " [ 150 / 500 ]  30% - 0:00:00 left \r",
      " [ 151 / 500 ]  30% - 0:00:00 left \r",
      " [ 152 / 500 ]  30% - 0:00:00 left \r",
      " [ 153 / 500 ]  31% - 0:00:00 left \r",
      " [ 154 / 500 ]  31% - 0:00:00 left \r",
      " [ 155 / 500 ]  31% - 0:00:00 left \r",
      " [ 156 / 500 ]  31% - 0:00:00 left \r",
      " [ 157 / 500 ]  31% - 0:00:00 left \r",
      " [ 158 / 500 ]  32% - 0:00:00 left \r",
      " [ 159 / 500 ]  32% - 0:00:00 left \r",
      " [ 160 / 500 ]  32% - 0:00:00 left \r",
      " [ 161 / 500 ]  32% - 0:00:00 left \r",
      " [ 162 / 500 ]  32% - 0:00:00 left \r",
      " [ 163 / 500 ]  33% - 0:00:00 left \r",
      " [ 164 / 500 ]  33% - 0:00:00 left \r",
      " [ 165 / 500 ]  33% - 0:00:00 left \r",
      " [ 166 / 500 ]  33% - 0:00:00 left \r",
      " [ 167 / 500 ]  33% - 0:00:00 left \r",
      " [ 168 / 500 ]  34% - 0:00:00 left \r",
      " [ 169 / 500 ]  34% - 0:00:00 left \r",
      " [ 170 / 500 ]  34% - 0:00:00 left \r",
      " [ 171 / 500 ]  34% - 0:00:00 left \r",
      " [ 172 / 500 ]  34% - 0:00:00 left \r",
      " [ 173 / 500 ]  35% - 0:00:00 left \r",
      " [ 174 / 500 ]  35% - 0:00:00 left \r",
      " [ 175 / 500 ]  35% - 0:00:00 left \r",
      " [ 176 / 500 ]  35% - 0:00:00 left \r",
      " [ 177 / 500 ]  35% - 0:00:00 left \r",
      " [ 178 / 500 ]  36% - 0:00:00 left \r",
      " [ 179 / 500 ]  36% - 0:00:00 left \r",
      " [ 180 / 500 ]  36% - 0:00:00 left \r",
      " [ 181 / 500 ]  36% - 0:00:00 left \r",
      " [ 182 / 500 ]  36% - 0:00:00 left \r",
      " [ 183 / 500 ]  37% - 0:00:00 left \r",
      " [ 184 / 500 ]  37% - 0:00:00 left \r",
      " [ 185 / 500 ]  37% - 0:00:00 left \r",
      " [ 186 / 500 ]  37% - 0:00:00 left \r",
      " [ 187 / 500 ]  37% - 0:00:00 left \r",
      " [ 188 / 500 ]  38% - 0:00:00 left \r",
      " [ 189 / 500 ]  38% - 0:00:00 left \r",
      " [ 190 / 500 ]  38% - 0:00:00 left \r",
      " [ 191 / 500 ]  38% - 0:00:00 left \r",
      " [ 192 / 500 ]  38% - 0:00:00 left \r",
      " [ 193 / 500 ]  39% - 0:00:00 left \r",
      " [ 194 / 500 ]  39% - 0:00:00 left \r",
      " [ 195 / 500 ]  39% - 0:00:00 left \r",
      " [ 196 / 500 ]  39% - 0:00:00 left \r",
      " [ 197 / 500 ]  39% - 0:00:00 left \r",
      " [ 198 / 500 ]  40% - 0:00:00 left \r",
      " [ 199 / 500 ]  40% - 0:00:00 left \r",
      " [ 200 / 500 ]  40% - 0:00:00 left \r",
      " [ 201 / 500 ]  40% - 0:00:00 left \r",
      " [ 202 / 500 ]  40% - 0:00:00 left \r",
      " [ 203 / 500 ]  41% - 0:00:00 left \r",
      " [ 204 / 500 ]  41% - 0:00:00 left \r",
      " [ 205 / 500 ]  41% - 0:00:00 left \r",
      " [ 206 / 500 ]  41% - 0:00:00 left \r",
      " [ 207 / 500 ]  41% - 0:00:00 left \r",
      " [ 208 / 500 ]  42% - 0:00:00 left \r",
      " [ 209 / 500 ]  42% - 0:00:00 left \r",
      " [ 210 / 500 ]  42% - 0:00:00 left \r",
      " [ 211 / 500 ]  42% - 0:00:00 left \r",
      " [ 212 / 500 ]  42% - 0:00:00 left \r",
      " [ 213 / 500 ]  43% - 0:00:00 left \r",
      " [ 214 / 500 ]  43% - 0:00:00 left \r",
      " [ 215 / 500 ]  43% - 0:00:00 left \r",
      " [ 216 / 500 ]  43% - 0:00:00 left \r",
      " [ 217 / 500 ]  43% - 0:00:00 left \r",
      " [ 218 / 500 ]  44% - 0:00:00 left \r",
      " [ 219 / 500 ]  44% - 0:00:00 left \r",
      " [ 220 / 500 ]  44% - 0:00:00 left \r",
      " [ 221 / 500 ]  44% - 0:00:00 left \r",
      " [ 222 / 500 ]  44% - 0:00:00 left \r",
      " [ 223 / 500 ]  45% - 0:00:00 left \r",
      " [ 224 / 500 ]  45% - 0:00:00 left \r",
      " [ 225 / 500 ]  45% - 0:00:00 left \r",
      " [ 226 / 500 ]  45% - 0:00:00 left \r",
      " [ 227 / 500 ]  45% - 0:00:00 left \r",
      " [ 228 / 500 ]  46% - 0:00:00 left \r",
      " [ 229 / 500 ]  46% - 0:00:00 left \r",
      " [ 230 / 500 ]  46% - 0:00:00 left \r",
      " [ 231 / 500 ]  46% - 0:00:00 left \r",
      " [ 232 / 500 ]  46% - 0:00:00 left \r",
      " [ 233 / 500 ]  47% - 0:00:00 left \r",
      " [ 234 / 500 ]  47% - 0:00:00 left \r",
      " [ 235 / 500 ]  47% - 0:00:00 left \r",
      " [ 236 / 500 ]  47% - 0:00:00 left \r",
      " [ 237 / 500 ]  47% - 0:00:00 left \r",
      " [ 238 / 500 ]  48% - 0:00:00 left \r",
      " [ 239 / 500 ]  48% - 0:00:00 left \r",
      " [ 240 / 500 ]  48% - 0:00:00 left \r",
      " [ 241 / 500 ]  48% - 0:00:00 left \r",
      " [ 242 / 500 ]  48% - 0:00:00 left \r",
      " [ 243 / 500 ]  49% - 0:00:00 left \r",
      " [ 244 / 500 ]  49% - 0:00:00 left \r",
      " [ 245 / 500 ]  49% - 0:00:00 left \r",
      " [ 246 / 500 ]  49% - 0:00:00 left \r",
      " [ 247 / 500 ]  49% - 0:00:00 left \r",
      " [ 248 / 500 ]  50% - 0:00:00 left \r",
      " [ 249 / 500 ]  50% - 0:00:00 left \r",
      " [ 250 / 500 ]  50% - 0:00:00 left \r",
      " [ 251 / 500 ]  50% - 0:00:00 left \r",
      " [ 252 / 500 ]  50% - 0:00:00 left \r",
      " [ 253 / 500 ]  51% - 0:00:00 left \r",
      " [ 254 / 500 ]  51% - 0:00:00 left \r",
      " [ 255 / 500 ]  51% - 0:00:00 left \r",
      " [ 256 / 500 ]  51% - 0:00:00 left \r",
      " [ 257 / 500 ]  51% - 0:00:00 left \r",
      " [ 258 / 500 ]  52% - 0:00:00 left \r",
      " [ 259 / 500 ]  52% - 0:00:00 left \r",
      " [ 260 / 500 ]  52% - 0:00:00 left \r",
      " [ 261 / 500 ]  52% - 0:00:00 left \r",
      " [ 262 / 500 ]  52% - 0:00:00 left \r",
      " [ 263 / 500 ]  53% - 0:00:00 left \r",
      " [ 264 / 500 ]  53% - 0:00:00 left \r",
      " [ 265 / 500 ]  53% - 0:00:00 left \r",
      " [ 266 / 500 ]  53% - 0:00:00 left \r",
      " [ 267 / 500 ]  53% - 0:00:00 left \r",
      " [ 268 / 500 ]  54% - 0:00:00 left \r",
      " [ 269 / 500 ]  54% - 0:00:00 left \r",
      " [ 270 / 500 ]  54% - 0:00:00 left \r",
      " [ 271 / 500 ]  54% - 0:00:00 left \r",
      " [ 272 / 500 ]  54% - 0:00:00 left \r",
      " [ 273 / 500 ]  55% - 0:00:00 left \r",
      " [ 274 / 500 ]  55% - 0:00:00 left \r",
      " [ 275 / 500 ]  55% - 0:00:00 left \r",
      " [ 276 / 500 ]  55% - 0:00:00 left \r",
      " [ 277 / 500 ]  55% - 0:00:00 left \r",
      " [ 278 / 500 ]  56% - 0:00:00 left \r",
      " [ 279 / 500 ]  56% - 0:00:00 left \r",
      " [ 280 / 500 ]  56% - 0:00:00 left \r",
      " [ 281 / 500 ]  56% - 0:00:00 left \r",
      " [ 282 / 500 ]  56% - 0:00:00 left \r",
      " [ 283 / 500 ]  57% - 0:00:00 left \r",
      " [ 284 / 500 ]  57% - 0:00:00 left \r",
      " [ 285 / 500 ]  57% - 0:00:00 left \r",
      " [ 286 / 500 ]  57% - 0:00:00 left \r",
      " [ 287 / 500 ]  57% - 0:00:00 left \r",
      " [ 288 / 500 ]  58% - 0:00:00 left \r",
      " [ 289 / 500 ]  58% - 0:00:00 left \r",
      " [ 290 / 500 ]  58% - 0:00:00 left \r",
      " [ 291 / 500 ]  58% - 0:00:00 left \r",
      " [ 292 / 500 ]  58% - 0:00:00 left \r",
      " [ 293 / 500 ]  59% - 0:00:00 left \r",
      " [ 294 / 500 ]  59% - 0:00:00 left \r",
      " [ 295 / 500 ]  59% - 0:00:00 left \r",
      " [ 296 / 500 ]  59% - 0:00:00 left \r",
      " [ 297 / 500 ]  59% - 0:00:00 left \r",
      " [ 298 / 500 ]  60% - 0:00:00 left \r",
      " [ 299 / 500 ]  60% - 0:00:00 left \r",
      " [ 300 / 500 ]  60% - 0:00:00 left \r",
      " [ 301 / 500 ]  60% - 0:00:00 left \r",
      " [ 302 / 500 ]  60% - 0:00:00 left \r",
      " [ 303 / 500 ]  61% - 0:00:00 left \r",
      " [ 304 / 500 ]  61% - 0:00:00 left \r",
      " [ 305 / 500 ]  61% - 0:00:00 left \r",
      " [ 306 / 500 ]  61% - 0:00:00 left \r",
      " [ 307 / 500 ]  61% - 0:00:00 left \r",
      " [ 308 / 500 ]  62% - 0:00:00 left \r",
      " [ 309 / 500 ]  62% - 0:00:00 left \r",
      " [ 310 / 500 ]  62% - 0:00:00 left \r",
      " [ 311 / 500 ]  62% - 0:00:00 left \r",
      " [ 312 / 500 ]  62% - 0:00:00 left \r",
      " [ 313 / 500 ]  63% - 0:00:00 left \r",
      " [ 314 / 500 ]  63% - 0:00:00 left \r",
      " [ 315 / 500 ]  63% - 0:00:00 left \r",
      " [ 316 / 500 ]  63% - 0:00:00 left \r",
      " [ 317 / 500 ]  63% - 0:00:00 left \r",
      " [ 318 / 500 ]  64% - 0:00:00 left \r",
      " [ 319 / 500 ]  64% - 0:00:00 left \r",
      " [ 320 / 500 ]  64% - 0:00:00 left \r",
      " [ 321 / 500 ]  64% - 0:00:00 left \r",
      " [ 322 / 500 ]  64% - 0:00:00 left \r",
      " [ 323 / 500 ]  65% - 0:00:00 left \r",
      " [ 324 / 500 ]  65% - 0:00:00 left \r",
      " [ 325 / 500 ]  65% - 0:00:00 left \r",
      " [ 326 / 500 ]  65% - 0:00:00 left \r",
      " [ 327 / 500 ]  65% - 0:00:00 left \r",
      " [ 328 / 500 ]  66% - 0:00:00 left \r",
      " [ 329 / 500 ]  66% - 0:00:00 left \r",
      " [ 330 / 500 ]  66% - 0:00:00 left \r",
      " [ 331 / 500 ]  66% - 0:00:00 left \r",
      " [ 332 / 500 ]  66% - 0:00:00 left \r",
      " [ 333 / 500 ]  67% - 0:00:00 left \r",
      " [ 334 / 500 ]  67% - 0:00:00 left \r",
      " [ 335 / 500 ]  67% - 0:00:00 left \r",
      " [ 336 / 500 ]  67% - 0:00:00 left \r",
      " [ 337 / 500 ]  67% - 0:00:00 left \r",
      " [ 338 / 500 ]  68% - 0:00:00 left \r",
      " [ 339 / 500 ]  68% - 0:00:00 left \r",
      " [ 340 / 500 ]  68% - 0:00:00 left \r",
      " [ 341 / 500 ]  68% - 0:00:00 left \r",
      " [ 342 / 500 ]  68% - 0:00:00 left \r",
      " [ 343 / 500 ]  69% - 0:00:00 left \r",
      " [ 344 / 500 ]  69% - 0:00:00 left \r",
      " [ 345 / 500 ]  69% - 0:00:00 left \r",
      " [ 346 / 500 ]  69% - 0:00:00 left \r",
      " [ 347 / 500 ]  69% - 0:00:00 left \r",
      " [ 348 / 500 ]  70% - 0:00:00 left \r",
      " [ 349 / 500 ]  70% - 0:00:00 left \r",
      " [ 350 / 500 ]  70% - 0:00:00 left \r",
      " [ 351 / 500 ]  70% - 0:00:00 left \r",
      " [ 352 / 500 ]  70% - 0:00:00 left \r",
      " [ 353 / 500 ]  71% - 0:00:00 left \r",
      " [ 354 / 500 ]  71% - 0:00:00 left \r",
      " [ 355 / 500 ]  71% - 0:00:00 left \r",
      " [ 356 / 500 ]  71% - 0:00:00 left \r",
      " [ 357 / 500 ]  71% - 0:00:00 left \r",
      " [ 358 / 500 ]  72% - 0:00:00 left \r",
      " [ 359 / 500 ]  72% - 0:00:00 left \r",
      " [ 360 / 500 ]  72% - 0:00:00 left \r",
      " [ 361 / 500 ]  72% - 0:00:00 left \r",
      " [ 362 / 500 ]  72% - 0:00:00 left \r",
      " [ 363 / 500 ]  73% - 0:00:00 left \r",
      " [ 364 / 500 ]  73% - 0:00:00 left \r",
      " [ 365 / 500 ]  73% - 0:00:00 left \r",
      " [ 366 / 500 ]  73% - 0:00:00 left \r",
      " [ 367 / 500 ]  73% - 0:00:00 left \r",
      " [ 368 / 500 ]  74% - 0:00:00 left \r",
      " [ 369 / 500 ]  74% - 0:00:00 left \r",
      " [ 370 / 500 ]  74% - 0:00:00 left \r",
      " [ 371 / 500 ]  74% - 0:00:00 left \r",
      " [ 372 / 500 ]  74% - 0:00:00 left \r",
      " [ 373 / 500 ]  75% - 0:00:00 left \r",
      " [ 374 / 500 ]  75% - 0:00:00 left \r",
      " [ 375 / 500 ]  75% - 0:00:00 left \r",
      " [ 376 / 500 ]  75% - 0:00:00 left \r",
      " [ 377 / 500 ]  75% - 0:00:00 left \r",
      " [ 378 / 500 ]  76% - 0:00:00 left \r",
      " [ 379 / 500 ]  76% - 0:00:00 left \r",
      " [ 380 / 500 ]  76% - 0:00:00 left \r",
      " [ 381 / 500 ]  76% - 0:00:00 left \r",
      " [ 382 / 500 ]  76% - 0:00:00 left \r",
      " [ 383 / 500 ]  77% - 0:00:00 left \r",
      " [ 384 / 500 ]  77% - 0:00:00 left \r",
      " [ 385 / 500 ]  77% - 0:00:00 left \r",
      " [ 386 / 500 ]  77% - 0:00:00 left \r",
      " [ 387 / 500 ]  77% - 0:00:00 left \r",
      " [ 388 / 500 ]  78% - 0:00:00 left \r",
      " [ 389 / 500 ]  78% - 0:00:00 left \r",
      " [ 390 / 500 ]  78% - 0:00:00 left \r",
      " [ 391 / 500 ]  78% - 0:00:00 left \r",
      " [ 392 / 500 ]  78% - 0:00:00 left \r",
      " [ 393 / 500 ]  79% - 0:00:00 left \r",
      " [ 394 / 500 ]  79% - 0:00:00 left \r",
      " [ 395 / 500 ]  79% - 0:00:00 left \r",
      " [ 396 / 500 ]  79% - 0:00:00 left \r",
      " [ 397 / 500 ]  79% - 0:00:00 left \r",
      " [ 398 / 500 ]  80% - 0:00:00 left \r",
      " [ 399 / 500 ]  80% - 0:00:00 left \r",
      " [ 400 / 500 ]  80% - 0:00:00 left \r",
      " [ 401 / 500 ]  80% - 0:00:00 left \r",
      " [ 402 / 500 ]  80% - 0:00:00 left \r",
      " [ 403 / 500 ]  81% - 0:00:00 left \r",
      " [ 404 / 500 ]  81% - 0:00:00 left \r",
      " [ 405 / 500 ]  81% - 0:00:00 left \r",
      " [ 406 / 500 ]  81% - 0:00:00 left \r",
      " [ 407 / 500 ]  81% - 0:00:00 left \r",
      " [ 408 / 500 ]  82% - 0:00:00 left \r",
      " [ 409 / 500 ]  82% - 0:00:00 left \r",
      " [ 410 / 500 ]  82% - 0:00:00 left \r",
      " [ 411 / 500 ]  82% - 0:00:00 left \r",
      " [ 412 / 500 ]  82% - 0:00:00 left \r",
      " [ 413 / 500 ]  83% - 0:00:00 left \r",
      " [ 414 / 500 ]  83% - 0:00:00 left \r",
      " [ 415 / 500 ]  83% - 0:00:00 left \r",
      " [ 416 / 500 ]  83% - 0:00:00 left \r",
      " [ 417 / 500 ]  83% - 0:00:00 left \r",
      " [ 418 / 500 ]  84% - 0:00:00 left \r",
      " [ 419 / 500 ]  84% - 0:00:00 left \r",
      " [ 420 / 500 ]  84% - 0:00:00 left \r",
      " [ 421 / 500 ]  84% - 0:00:00 left \r",
      " [ 422 / 500 ]  84% - 0:00:00 left \r",
      " [ 423 / 500 ]  85% - 0:00:00 left \r",
      " [ 424 / 500 ]  85% - 0:00:00 left \r",
      " [ 425 / 500 ]  85% - 0:00:00 left \r",
      " [ 426 / 500 ]  85% - 0:00:00 left \r",
      " [ 427 / 500 ]  85% - 0:00:00 left \r",
      " [ 428 / 500 ]  86% - 0:00:00 left \r",
      " [ 429 / 500 ]  86% - 0:00:00 left \r",
      " [ 430 / 500 ]  86% - 0:00:00 left \r",
      " [ 431 / 500 ]  86% - 0:00:00 left \r",
      " [ 432 / 500 ]  86% - 0:00:00 left \r",
      " [ 433 / 500 ]  87% - 0:00:00 left \r",
      " [ 434 / 500 ]  87% - 0:00:00 left \r",
      " [ 435 / 500 ]  87% - 0:00:00 left \r",
      " [ 436 / 500 ]  87% - 0:00:00 left \r",
      " [ 437 / 500 ]  87% - 0:00:00 left \r",
      " [ 438 / 500 ]  88% - 0:00:00 left \r",
      " [ 439 / 500 ]  88% - 0:00:00 left \r",
      " [ 440 / 500 ]  88% - 0:00:00 left \r",
      " [ 441 / 500 ]  88% - 0:00:00 left \r",
      " [ 442 / 500 ]  88% - 0:00:00 left \r",
      " [ 443 / 500 ]  89% - 0:00:00 left \r",
      " [ 444 / 500 ]  89% - 0:00:00 left \r",
      " [ 445 / 500 ]  89% - 0:00:00 left \r",
      " [ 446 / 500 ]  89% - 0:00:00 left \r",
      " [ 447 / 500 ]  89% - 0:00:00 left \r",
      " [ 448 / 500 ]  90% - 0:00:00 left \r",
      " [ 449 / 500 ]  90% - 0:00:00 left \r",
      " [ 450 / 500 ]  90% - 0:00:00 left \r",
      " [ 451 / 500 ]  90% - 0:00:00 left \r",
      " [ 452 / 500 ]  90% - 0:00:00 left \r",
      " [ 453 / 500 ]  91% - 0:00:00 left \r",
      " [ 454 / 500 ]  91% - 0:00:00 left \r",
      " [ 455 / 500 ]  91% - 0:00:00 left \r",
      " [ 456 / 500 ]  91% - 0:00:00 left \r",
      " [ 457 / 500 ]  91% - 0:00:00 left \r",
      " [ 458 / 500 ]  92% - 0:00:00 left \r",
      " [ 459 / 500 ]  92% - 0:00:00 left \r",
      " [ 460 / 500 ]  92% - 0:00:00 left \r",
      " [ 461 / 500 ]  92% - 0:00:00 left \r",
      " [ 462 / 500 ]  92% - 0:00:00 left \r",
      " [ 463 / 500 ]  93% - 0:00:00 left \r",
      " [ 464 / 500 ]  93% - 0:00:00 left \r",
      " [ 465 / 500 ]  93% - 0:00:00 left \r",
      " [ 466 / 500 ]  93% - 0:00:00 left \r",
      " [ 467 / 500 ]  93% - 0:00:00 left \r",
      " [ 468 / 500 ]  94% - 0:00:00 left \r",
      " [ 469 / 500 ]  94% - 0:00:00 left \r",
      " [ 470 / 500 ]  94% - 0:00:00 left \r",
      " [ 471 / 500 ]  94% - 0:00:00 left \r",
      " [ 472 / 500 ]  94% - 0:00:00 left \r",
      " [ 473 / 500 ]  95% - 0:00:00 left \r",
      " [ 474 / 500 ]  95% - 0:00:00 left \r",
      " [ 475 / 500 ]  95% - 0:00:00 left \r",
      " [ 476 / 500 ]  95% - 0:00:00 left \r",
      " [ 477 / 500 ]  95% - 0:00:00 left \r",
      " [ 478 / 500 ]  96% - 0:00:00 left \r",
      " [ 479 / 500 ]  96% - 0:00:00 left \r",
      " [ 480 / 500 ]  96% - 0:00:00 left \r",
      " [ 481 / 500 ]  96% - 0:00:00 left \r",
      " [ 482 / 500 ]  96% - 0:00:00 left \r",
      " [ 483 / 500 ]  97% - 0:00:00 left \r",
      " [ 484 / 500 ]  97% - 0:00:00 left \r",
      " [ 485 / 500 ]  97% - 0:00:00 left \r",
      " [ 486 / 500 ]  97% - 0:00:00 left \r",
      " [ 487 / 500 ]  97% - 0:00:00 left \r",
      " [ 488 / 500 ]  98% - 0:00:00 left \r",
      " [ 489 / 500 ]  98% - 0:00:00 left \r",
      " [ 490 / 500 ]  98% - 0:00:00 left \r",
      " [ 491 / 500 ]  98% - 0:00:00 left \r",
      " [ 492 / 500 ]  98% - 0:00:00 left \r",
      " [ 493 / 500 ]  99% - 0:00:00 left \r",
      " [ 494 / 500 ]  99% - 0:00:00 left \r",
      " [ 495 / 500 ]  99% - 0:00:00 left \r",
      " [ 496 / 500 ]  99% - 0:00:00 left \r",
      " [ 497 / 500 ]  99% - 0:00:00 left \r",
      " [ 498 / 500 ] 100% - 0:00:00 left \r",
      " [ 499 / 500 ] 100% - 0:00:00 left \r",
      " [ 500 / 500 ] 100% - 0:00:00 left \n",
      " quantization error: 1.3640620422483852e-05\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<matplotlib.image.AxesImage at 0x112c972e0>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAPsAAAD5CAYAAADhukOtAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8li6FKAAAWxUlEQVR4nO3dbYxc5XUH8P+ZOzM7szP7/uKsF4OBuqkQtHa6tVKBKtIoEUWpDKqEwofIlVCdD0EKUj4U0Q9B/YSqQBSpFZIpVpyKkkQChD+gNhRFolElxBo52OAGDLLBy9pre9ld27vel5nTD3Ohi7Pn3GXe7uDn/5Ms786ZO/fZO3PmzsyZ8zyiqiCia18m7QEQUXsw2YkCwWQn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 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "som.train(colors, 500, random_order=True, verbose=True)\n",
    "\n",
    "plt.imshow(abs(som.get_weights()), interpolation='none')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Using a different neighborhood function the weights be less smooth across the map:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\r",
      " [   0 / 500 ]   0% - ? it/s\r",
      " [   0 / 500 ]   0% - ? it/s\r",
      " [   1 / 500 ]   0% - 0:00:00 left \r",
      " [   2 / 500 ]   0% - 0:00:00 left \r",
      " [   3 / 500 ]   1% - 0:00:00 left \r",
      " [   4 / 500 ]   1% - 0:00:00 left \r",
      " [   5 / 500 ]   1% - 0:00:00 left \r",
      " [   6 / 500 ]   1% - 0:00:00 left \r",
      " [   7 / 500 ]   1% - 0:00:00 left \r",
      " [   8 / 500 ]   2% - 0:00:00 left \r",
      " [   9 / 500 ]   2% - 0:00:00 left \r",
      " [  10 / 500 ]   2% - 0:00:00 left \r",
      " [  11 / 500 ]   2% - 0:00:00 left \r",
      " [  12 / 500 ]   2% - 0:00:00 left \r",
      " [  13 / 500 ]   3% - 0:00:00 left \r",
      " [  14 / 500 ]   3% - 0:00:00 left \r",
      " [  15 / 500 ]   3% - 0:00:00 left \r",
      " [  16 / 500 ]   3% - 0:00:00 left \r",
      " [  17 / 500 ]   3% - 0:00:00 left \r",
      " [  18 / 500 ]   4% - 0:00:00 left \r",
      " [  19 / 500 ]   4% - 0:00:00 left \r",
      " [  20 / 500 ]   4% - 0:00:00 left \r",
      " [  21 / 500 ]   4% - 0:00:00 left \r",
      " [  22 / 500 ]   4% - 0:00:00 left \r",
      " [  23 / 500 ]   5% - 0:00:00 left \r",
      " [  24 / 500 ]   5% - 0:00:00 left \r",
      " [  25 / 500 ]   5% - 0:00:00 left \r",
      " [  26 / 500 ]   5% - 0:00:00 left \r",
      " [  27 / 500 ]   5% - 0:00:00 left \r",
      " [  28 / 500 ]   6% - 0:00:00 left \r",
      " [  29 / 500 ]   6% - 0:00:00 left \r",
      " [  30 / 500 ]   6% - 0:00:00 left \r",
      " [  31 / 500 ]   6% - 0:00:00 left \r",
      " [  32 / 500 ]   6% - 0:00:00 left \r",
      " [  33 / 500 ]   7% - 0:00:00 left \r",
      " [  34 / 500 ]   7% - 0:00:00 left \r",
      " [  35 / 500 ]   7% - 0:00:00 left \r",
      " [  36 / 500 ]   7% - 0:00:00 left \r",
      " [  37 / 500 ]   7% - 0:00:00 left \r",
      " [  38 / 500 ]   8% - 0:00:00 left \r",
      " [  39 / 500 ]   8% - 0:00:00 left \r",
      " [  40 / 500 ]   8% - 0:00:00 left \r",
      " [  41 / 500 ]   8% - 0:00:00 left \r",
      " [  42 / 500 ]   8% - 0:00:00 left \r",
      " [  43 / 500 ]   9% - 0:00:00 left \r",
      " [  44 / 500 ]   9% - 0:00:00 left \r",
      " [  45 / 500 ]   9% - 0:00:00 left \r",
      " [  46 / 500 ]   9% - 0:00:00 left \r",
      " [  47 / 500 ]   9% - 0:00:00 left \r",
      " [  48 / 500 ]  10% - 0:00:00 left \r",
      " [  49 / 500 ]  10% - 0:00:00 left \r",
      " [  50 / 500 ]  10% - 0:00:00 left \r",
      " [  51 / 500 ]  10% - 0:00:00 left \r",
      " [  52 / 500 ]  10% - 0:00:00 left \r",
      " [  53 / 500 ]  11% - 0:00:00 left \r",
      " [  54 / 500 ]  11% - 0:00:00 left \r",
      " [  55 / 500 ]  11% - 0:00:00 left \r",
      " [  56 / 500 ]  11% - 0:00:00 left \r",
      " [  57 / 500 ]  11% - 0:00:00 left \r",
      " [  58 / 500 ]  12% - 0:00:00 left \r",
      " [  59 / 500 ]  12% - 0:00:00 left \r",
      " [  60 / 500 ]  12% - 0:00:00 left \r",
      " [  61 / 500 ]  12% - 0:00:00 left \r",
      " [  62 / 500 ]  12% - 0:00:00 left \r",
      " [  63 / 500 ]  13% - 0:00:00 left \r",
      " [  64 / 500 ]  13% - 0:00:00 left \r",
      " [  65 / 500 ]  13% - 0:00:00 left \r",
      " [  66 / 500 ]  13% - 0:00:00 left \r",
      " [  67 / 500 ]  13% - 0:00:00 left \r",
      " [  68 / 500 ]  14% - 0:00:00 left \r",
      " [  69 / 500 ]  14% - 0:00:00 left \r",
      " [  70 / 500 ]  14% - 0:00:00 left \r",
      " [  71 / 500 ]  14% - 0:00:00 left \r",
      " [  72 / 500 ]  14% - 0:00:00 left \r",
      " [  73 / 500 ]  15% - 0:00:00 left \r",
      " [  74 / 500 ]  15% - 0:00:00 left \r",
      " [  75 / 500 ]  15% - 0:00:00 left \r",
      " [  76 / 500 ]  15% - 0:00:00 left \r",
      " [  77 / 500 ]  15% - 0:00:00 left \r",
      " [  78 / 500 ]  16% - 0:00:00 left \r",
      " [  79 / 500 ]  16% - 0:00:00 left \r",
      " [  80 / 500 ]  16% - 0:00:00 left \r",
      " [  81 / 500 ]  16% - 0:00:00 left \r",
      " [  82 / 500 ]  16% - 0:00:00 left \r",
      " [  83 / 500 ]  17% - 0:00:00 left \r",
      " [  84 / 500 ]  17% - 0:00:00 left \r",
      " [  85 / 500 ]  17% - 0:00:00 left \r",
      " [  86 / 500 ]  17% - 0:00:00 left \r",
      " [  87 / 500 ]  17% - 0:00:00 left \r",
      " [  88 / 500 ]  18% - 0:00:00 left \r",
      " [  89 / 500 ]  18% - 0:00:00 left \r",
      " [  90 / 500 ]  18% - 0:00:00 left \r",
      " [  91 / 500 ]  18% - 0:00:00 left \r",
      " [  92 / 500 ]  18% - 0:00:00 left \r",
      " [  93 / 500 ]  19% - 0:00:00 left \r",
      " [  94 / 500 ]  19% - 0:00:00 left \r",
      " [  95 / 500 ]  19% - 0:00:00 left \r",
      " [  96 / 500 ]  19% - 0:00:00 left \r",
      " [  97 / 500 ]  19% - 0:00:00 left \r",
      " [  98 / 500 ]  20% - 0:00:00 left \r",
      " [  99 / 500 ]  20% - 0:00:00 left \r",
      " [ 100 / 500 ]  20% - 0:00:00 left \r",
      " [ 101 / 500 ]  20% - 0:00:00 left \r",
      " [ 102 / 500 ]  20% - 0:00:00 left \r",
      " [ 103 / 500 ]  21% - 0:00:00 left \r",
      " [ 104 / 500 ]  21% - 0:00:00 left \r",
      " [ 105 / 500 ]  21% - 0:00:00 left \r",
      " [ 106 / 500 ]  21% - 0:00:00 left \r",
      " [ 107 / 500 ]  21% - 0:00:00 left \r",
      " [ 108 / 500 ]  22% - 0:00:00 left \r",
      " [ 109 / 500 ]  22% - 0:00:00 left \r",
      " [ 110 / 500 ]  22% - 0:00:00 left \r",
      " [ 111 / 500 ]  22% - 0:00:00 left \r",
      " [ 112 / 500 ]  22% - 0:00:00 left \r",
      " [ 113 / 500 ]  23% - 0:00:00 left \r",
      " [ 114 / 500 ]  23% - 0:00:00 left \r",
      " [ 115 / 500 ]  23% - 0:00:00 left \r",
      " [ 116 / 500 ]  23% - 0:00:00 left \r",
      " [ 117 / 500 ]  23% - 0:00:00 left \r",
      " [ 118 / 500 ]  24% - 0:00:00 left \r",
      " [ 119 / 500 ]  24% - 0:00:00 left \r",
      " [ 120 / 500 ]  24% - 0:00:00 left \r",
      " [ 121 / 500 ]  24% - 0:00:00 left \r",
      " [ 122 / 500 ]  24% - 0:00:00 left \r",
      " [ 123 / 500 ]  25% - 0:00:00 left \r",
      " [ 124 / 500 ]  25% - 0:00:00 left \r",
      " [ 125 / 500 ]  25% - 0:00:00 left \r",
      " [ 126 / 500 ]  25% - 0:00:00 left \r",
      " [ 127 / 500 ]  25% - 0:00:00 left \r",
      " [ 128 / 500 ]  26% - 0:00:00 left \r",
      " [ 129 / 500 ]  26% - 0:00:00 left \r",
      " [ 130 / 500 ]  26% - 0:00:00 left \r",
      " [ 131 / 500 ]  26% - 0:00:00 left \r",
      " [ 132 / 500 ]  26% - 0:00:00 left \r",
      " [ 133 / 500 ]  27% - 0:00:00 left \r",
      " [ 134 / 500 ]  27% - 0:00:00 left \r",
      " [ 135 / 500 ]  27% - 0:00:00 left \r",
      " [ 136 / 500 ]  27% - 0:00:00 left \r",
      " [ 137 / 500 ]  27% - 0:00:00 left \r",
      " [ 138 / 500 ]  28% - 0:00:00 left \r",
      " [ 139 / 500 ]  28% - 0:00:00 left \r",
      " [ 140 / 500 ]  28% - 0:00:00 left \r",
      " [ 141 / 500 ]  28% - 0:00:00 left \r",
      " [ 142 / 500 ]  28% - 0:00:00 left \r",
      " [ 143 / 500 ]  29% - 0:00:00 left \r",
      " [ 144 / 500 ]  29% - 0:00:00 left \r",
      " [ 145 / 500 ]  29% - 0:00:00 left \r",
      " [ 146 / 500 ]  29% - 0:00:00 left \r",
      " [ 147 / 500 ]  29% - 0:00:00 left \r",
      " [ 148 / 500 ]  30% - 0:00:00 left \r",
      " [ 149 / 500 ]  30% - 0:00:00 left \r",
      " [ 150 / 500 ]  30% - 0:00:00 left \r",
      " [ 151 / 500 ]  30% - 0:00:00 left \r",
      " [ 152 / 500 ]  30% - 0:00:00 left \r",
      " [ 153 / 500 ]  31% - 0:00:00 left \r",
      " [ 154 / 500 ]  31% - 0:00:00 left \r",
      " [ 155 / 500 ]  31% - 0:00:00 left \r",
      " [ 156 / 500 ]  31% - 0:00:00 left \r",
      " [ 157 / 500 ]  31% - 0:00:00 left \r",
      " [ 158 / 500 ]  32% - 0:00:00 left \r",
      " [ 159 / 500 ]  32% - 0:00:00 left \r",
      " [ 160 / 500 ]  32% - 0:00:00 left \r",
      " [ 161 / 500 ]  32% - 0:00:00 left \r",
      " [ 162 / 500 ]  32% - 0:00:00 left \r",
      " [ 163 / 500 ]  33% - 0:00:00 left \r",
      " [ 164 / 500 ]  33% - 0:00:00 left \r",
      " [ 165 / 500 ]  33% - 0:00:00 left \r",
      " [ 166 / 500 ]  33% - 0:00:00 left \r",
      " [ 167 / 500 ]  33% - 0:00:00 left \r",
      " [ 168 / 500 ]  34% - 0:00:00 left \r",
      " [ 169 / 500 ]  34% - 0:00:00 left \r",
      " [ 170 / 500 ]  34% - 0:00:00 left \r",
      " [ 171 / 500 ]  34% - 0:00:00 left \r",
      " [ 172 / 500 ]  34% - 0:00:00 left \r",
      " [ 173 / 500 ]  35% - 0:00:00 left \r",
      " [ 174 / 500 ]  35% - 0:00:00 left \r",
      " [ 175 / 500 ]  35% - 0:00:00 left \r",
      " [ 176 / 500 ]  35% - 0:00:00 left \r",
      " [ 177 / 500 ]  35% - 0:00:00 left \r",
      " [ 178 / 500 ]  36% - 0:00:00 left \r",
      " [ 179 / 500 ]  36% - 0:00:00 left \r",
      " [ 180 / 500 ]  36% - 0:00:00 left \r",
      " [ 181 / 500 ]  36% - 0:00:00 left \r",
      " [ 182 / 500 ]  36% - 0:00:00 left \r",
      " [ 183 / 500 ]  37% - 0:00:00 left \r",
      " [ 184 / 500 ]  37% - 0:00:00 left \r",
      " [ 185 / 500 ]  37% - 0:00:00 left \r",
      " [ 186 / 500 ]  37% - 0:00:00 left \r",
      " [ 187 / 500 ]  37% - 0:00:00 left \r",
      " [ 188 / 500 ]  38% - 0:00:00 left \r",
      " [ 189 / 500 ]  38% - 0:00:00 left \r",
      " [ 190 / 500 ]  38% - 0:00:00 left \r",
      " [ 191 / 500 ]  38% - 0:00:00 left \r",
      " [ 192 / 500 ]  38% - 0:00:00 left \r",
      " [ 193 / 500 ]  39% - 0:00:00 left \r",
      " [ 194 / 500 ]  39% - 0:00:00 left \r",
      " [ 195 / 500 ]  39% - 0:00:00 left \r",
      " [ 196 / 500 ]  39% - 0:00:00 left \r",
      " [ 197 / 500 ]  39% - 0:00:00 left \r",
      " [ 198 / 500 ]  40% - 0:00:00 left \r",
      " [ 199 / 500 ]  40% - 0:00:00 left \r",
      " [ 200 / 500 ]  40% - 0:00:00 left \r",
      " [ 201 / 500 ]  40% - 0:00:00 left \r",
      " [ 202 / 500 ]  40% - 0:00:00 left \r",
      " [ 203 / 500 ]  41% - 0:00:00 left \r",
      " [ 204 / 500 ]  41% - 0:00:00 left \r",
      " [ 205 / 500 ]  41% - 0:00:00 left \r",
      " [ 206 / 500 ]  41% - 0:00:00 left \r",
      " [ 207 / 500 ]  41% - 0:00:00 left \r",
      " [ 208 / 500 ]  42% - 0:00:00 left \r",
      " [ 209 / 500 ]  42% - 0:00:00 left \r",
      " [ 210 / 500 ]  42% - 0:00:00 left \r",
      " [ 211 / 500 ]  42% - 0:00:00 left \r",
      " [ 212 / 500 ]  42% - 0:00:00 left \r",
      " [ 213 / 500 ]  43% - 0:00:00 left \r",
      " [ 214 / 500 ]  43% - 0:00:00 left \r",
      " [ 215 / 500 ]  43% - 0:00:00 left \r",
      " [ 216 / 500 ]  43% - 0:00:00 left \r",
      " [ 217 / 500 ]  43% - 0:00:00 left \r",
      " [ 218 / 500 ]  44% - 0:00:00 left \r",
      " [ 219 / 500 ]  44% - 0:00:00 left \r",
      " [ 220 / 500 ]  44% - 0:00:00 left \r",
      " [ 221 / 500 ]  44% - 0:00:00 left \r",
      " [ 222 / 500 ]  44% - 0:00:00 left \r",
      " [ 223 / 500 ]  45% - 0:00:00 left \r",
      " [ 224 / 500 ]  45% - 0:00:00 left \r",
      " [ 225 / 500 ]  45% - 0:00:00 left \r",
      " [ 226 / 500 ]  45% - 0:00:00 left \r",
      " [ 227 / 500 ]  45% - 0:00:00 left \r",
      " [ 228 / 500 ]  46% - 0:00:00 left \r",
      " [ 229 / 500 ]  46% - 0:00:00 left \r",
      " [ 230 / 500 ]  46% - 0:00:00 left \r",
      " [ 231 / 500 ]  46% - 0:00:00 left \r",
      " [ 232 / 500 ]  46% - 0:00:00 left \r",
      " [ 233 / 500 ]  47% - 0:00:00 left \r",
      " [ 234 / 500 ]  47% - 0:00:00 left \r",
      " [ 235 / 500 ]  47% - 0:00:00 left \r",
      " [ 236 / 500 ]  47% - 0:00:00 left \r",
      " [ 237 / 500 ]  47% - 0:00:00 left \r",
      " [ 238 / 500 ]  48% - 0:00:00 left \r",
      " [ 239 / 500 ]  48% - 0:00:00 left \r",
      " [ 240 / 500 ]  48% - 0:00:00 left \r",
      " [ 241 / 500 ]  48% - 0:00:00 left \r",
      " [ 242 / 500 ]  48% - 0:00:00 left \r",
      " [ 243 / 500 ]  49% - 0:00:00 left \r",
      " [ 244 / 500 ]  49% - 0:00:00 left \r",
      " [ 245 / 500 ]  49% - 0:00:00 left \r",
      " [ 246 / 500 ]  49% - 0:00:00 left \r",
      " [ 247 / 500 ]  49% - 0:00:00 left \r",
      " [ 248 / 500 ]  50% - 0:00:00 left \r",
      " [ 249 / 500 ]  50% - 0:00:00 left \r",
      " [ 250 / 500 ]  50% - 0:00:00 left \r",
      " [ 251 / 500 ]  50% - 0:00:00 left \r",
      " [ 252 / 500 ]  50% - 0:00:00 left \r",
      " [ 253 / 500 ]  51% - 0:00:00 left \r",
      " [ 254 / 500 ]  51% - 0:00:00 left \r",
      " [ 255 / 500 ]  51% - 0:00:00 left \r",
      " [ 256 / 500 ]  51% - 0:00:00 left \r",
      " [ 257 / 500 ]  51% - 0:00:00 left \r",
      " [ 258 / 500 ]  52% - 0:00:00 left \r",
      " [ 259 / 500 ]  52% - 0:00:00 left \r",
      " [ 260 / 500 ]  52% - 0:00:00 left \r",
      " [ 261 / 500 ]  52% - 0:00:00 left \r",
      " [ 262 / 500 ]  52% - 0:00:00 left \r",
      " [ 263 / 500 ]  53% - 0:00:00 left \r",
      " [ 264 / 500 ]  53% - 0:00:00 left \r",
      " [ 265 / 500 ]  53% - 0:00:00 left \r",
      " [ 266 / 500 ]  53% - 0:00:00 left \r",
      " [ 267 / 500 ]  53% - 0:00:00 left \r",
      " [ 268 / 500 ]  54% - 0:00:00 left \r",
      " [ 269 / 500 ]  54% - 0:00:00 left \r",
      " [ 270 / 500 ]  54% - 0:00:00 left \r",
      " [ 271 / 500 ]  54% - 0:00:00 left \r",
      " [ 272 / 500 ]  54% - 0:00:00 left \r",
      " [ 273 / 500 ]  55% - 0:00:00 left \r",
      " [ 274 / 500 ]  55% - 0:00:00 left \r",
      " [ 275 / 500 ]  55% - 0:00:00 left \r",
      " [ 276 / 500 ]  55% - 0:00:00 left \r",
      " [ 277 / 500 ]  55% - 0:00:00 left \r",
      " [ 278 / 500 ]  56% - 0:00:00 left \r",
      " [ 279 / 500 ]  56% - 0:00:00 left \r",
      " [ 280 / 500 ]  56% - 0:00:00 left \r",
      " [ 281 / 500 ]  56% - 0:00:00 left \r",
      " [ 282 / 500 ]  56% - 0:00:00 left \r",
      " [ 283 / 500 ]  57% - 0:00:00 left \r",
      " [ 284 / 500 ]  57% - 0:00:00 left \r",
      " [ 285 / 500 ]  57% - 0:00:00 left \r",
      " [ 286 / 500 ]  57% - 0:00:00 left \r",
      " [ 287 / 500 ]  57% - 0:00:00 left \r",
      " [ 288 / 500 ]  58% - 0:00:00 left \r",
      " [ 289 / 500 ]  58% - 0:00:00 left \r",
      " [ 290 / 500 ]  58% - 0:00:00 left \r",
      " [ 291 / 500 ]  58% - 0:00:00 left \r",
      " [ 292 / 500 ]  58% - 0:00:00 left \r",
      " [ 293 / 500 ]  59% - 0:00:00 left \r",
      " [ 294 / 500 ]  59% - 0:00:00 left \r",
      " [ 295 / 500 ]  59% - 0:00:00 left \r",
      " [ 296 / 500 ]  59% - 0:00:00 left \r",
      " [ 297 / 500 ]  59% - 0:00:00 left \r",
      " [ 298 / 500 ]  60% - 0:00:00 left \r",
      " [ 299 / 500 ]  60% - 0:00:00 left \r",
      " [ 300 / 500 ]  60% - 0:00:00 left \r",
      " [ 301 / 500 ]  60% - 0:00:00 left \r",
      " [ 302 / 500 ]  60% - 0:00:00 left \r",
      " [ 303 / 500 ]  61% - 0:00:00 left \r",
      " [ 304 / 500 ]  61% - 0:00:00 left \r",
      " [ 305 / 500 ]  61% - 0:00:00 left \r",
      " [ 306 / 500 ]  61% - 0:00:00 left \r",
      " [ 307 / 500 ]  61% - 0:00:00 left \r",
      " [ 308 / 500 ]  62% - 0:00:00 left \r",
      " [ 309 / 500 ]  62% - 0:00:00 left \r",
      " [ 310 / 500 ]  62% - 0:00:00 left \r",
      " [ 311 / 500 ]  62% - 0:00:00 left \r",
      " [ 312 / 500 ]  62% - 0:00:00 left \r",
      " [ 313 / 500 ]  63% - 0:00:00 left \r",
      " [ 314 / 500 ]  63% - 0:00:00 left \r",
      " [ 315 / 500 ]  63% - 0:00:00 left \r",
      " [ 316 / 500 ]  63% - 0:00:00 left \r",
      " [ 317 / 500 ]  63% - 0:00:00 left \r",
      " [ 318 / 500 ]  64% - 0:00:00 left \r",
      " [ 319 / 500 ]  64% - 0:00:00 left \r",
      " [ 320 / 500 ]  64% - 0:00:00 left \r",
      " [ 321 / 500 ]  64% - 0:00:00 left \r",
      " [ 322 / 500 ]  64% - 0:00:00 left \r",
      " [ 323 / 500 ]  65% - 0:00:00 left \r",
      " [ 324 / 500 ]  65% - 0:00:00 left \r",
      " [ 325 / 500 ]  65% - 0:00:00 left \r",
      " [ 326 / 500 ]  65% - 0:00:00 left \r",
      " [ 327 / 500 ]  65% - 0:00:00 left \r",
      " [ 328 / 500 ]  66% - 0:00:00 left \r",
      " [ 329 / 500 ]  66% - 0:00:00 left \r",
      " [ 330 / 500 ]  66% - 0:00:00 left \r",
      " [ 331 / 500 ]  66% - 0:00:00 left \r",
      " [ 332 / 500 ]  66% - 0:00:00 left \r",
      " [ 333 / 500 ]  67% - 0:00:00 left \r",
      " [ 334 / 500 ]  67% - 0:00:00 left \r",
      " [ 335 / 500 ]  67% - 0:00:00 left \r",
      " [ 336 / 500 ]  67% - 0:00:00 left \r",
      " [ 337 / 500 ]  67% - 0:00:00 left \r",
      " [ 338 / 500 ]  68% - 0:00:00 left \r",
      " [ 339 / 500 ]  68% - 0:00:00 left \r",
      " [ 340 / 500 ]  68% - 0:00:00 left \r",
      " [ 341 / 500 ]  68% - 0:00:00 left \r",
      " [ 342 / 500 ]  68% - 0:00:00 left \r",
      " [ 343 / 500 ]  69% - 0:00:00 left \r",
      " [ 344 / 500 ]  69% - 0:00:00 left \r",
      " [ 345 / 500 ]  69% - 0:00:00 left \r",
      " [ 346 / 500 ]  69% - 0:00:00 left \r",
      " [ 347 / 500 ]  69% - 0:00:00 left \r",
      " [ 348 / 500 ]  70% - 0:00:00 left \r",
      " [ 349 / 500 ]  70% - 0:00:00 left \r",
      " [ 350 / 500 ]  70% - 0:00:00 left \r",
      " [ 351 / 500 ]  70% - 0:00:00 left \r",
      " [ 352 / 500 ]  70% - 0:00:00 left \r",
      " [ 353 / 500 ]  71% - 0:00:00 left \r",
      " [ 354 / 500 ]  71% - 0:00:00 left \r",
      " [ 355 / 500 ]  71% - 0:00:00 left \r",
      " [ 356 / 500 ]  71% - 0:00:00 left \r",
      " [ 357 / 500 ]  71% - 0:00:00 left \r",
      " [ 358 / 500 ]  72% - 0:00:00 left \r",
      " [ 359 / 500 ]  72% - 0:00:00 left \r",
      " [ 360 / 500 ]  72% - 0:00:00 left \r",
      " [ 361 / 500 ]  72% - 0:00:00 left \r",
      " [ 362 / 500 ]  72% - 0:00:00 left \r",
      " [ 363 / 500 ]  73% - 0:00:00 left \r",
      " [ 364 / 500 ]  73% - 0:00:00 left \r",
      " [ 365 / 500 ]  73% - 0:00:00 left \r",
      " [ 366 / 500 ]  73% - 0:00:00 left \r",
      " [ 367 / 500 ]  73% - 0:00:00 left \r",
      " [ 368 / 500 ]  74% - 0:00:00 left \r",
      " [ 369 / 500 ]  74% - 0:00:00 left \r",
      " [ 370 / 500 ]  74% - 0:00:00 left \r",
      " [ 371 / 500 ]  74% - 0:00:00 left \r",
      " [ 372 / 500 ]  74% - 0:00:00 left \r",
      " [ 373 / 500 ]  75% - 0:00:00 left \r",
      " [ 374 / 500 ]  75% - 0:00:00 left \r",
      " [ 375 / 500 ]  75% - 0:00:00 left \r",
      " [ 376 / 500 ]  75% - 0:00:00 left \r",
      " [ 377 / 500 ]  75% - 0:00:00 left \r",
      " [ 378 / 500 ]  76% - 0:00:00 left \r",
      " [ 379 / 500 ]  76% - 0:00:00 left \r",
      " [ 380 / 500 ]  76% - 0:00:00 left \r",
      " [ 381 / 500 ]  76% - 0:00:00 left \r",
      " [ 382 / 500 ]  76% - 0:00:00 left \r",
      " [ 383 / 500 ]  77% - 0:00:00 left \r",
      " [ 384 / 500 ]  77% - 0:00:00 left \r",
      " [ 385 / 500 ]  77% - 0:00:00 left \r",
      " [ 386 / 500 ]  77% - 0:00:00 left \r",
      " [ 387 / 500 ]  77% - 0:00:00 left \r",
      " [ 388 / 500 ]  78% - 0:00:00 left \r",
      " [ 389 / 500 ]  78% - 0:00:00 left \r",
      " [ 390 / 500 ]  78% - 0:00:00 left \r",
      " [ 391 / 500 ]  78% - 0:00:00 left \r",
      " [ 392 / 500 ]  78% - 0:00:00 left \r",
      " [ 393 / 500 ]  79% - 0:00:00 left \r",
      " [ 394 / 500 ]  79% - 0:00:00 left \r",
      " [ 395 / 500 ]  79% - 0:00:00 left \r",
      " [ 396 / 500 ]  79% - 0:00:00 left \r",
      " [ 397 / 500 ]  79% - 0:00:00 left \r",
      " [ 398 / 500 ]  80% - 0:00:00 left \r",
      " [ 399 / 500 ]  80% - 0:00:00 left \r",
      " [ 400 / 500 ]  80% - 0:00:00 left \r",
      " [ 401 / 500 ]  80% - 0:00:00 left \r",
      " [ 402 / 500 ]  80% - 0:00:00 left \r",
      " [ 403 / 500 ]  81% - 0:00:00 left \r",
      " [ 404 / 500 ]  81% - 0:00:00 left \r",
      " [ 405 / 500 ]  81% - 0:00:00 left \r",
      " [ 406 / 500 ]  81% - 0:00:00 left \r",
      " [ 407 / 500 ]  81% - 0:00:00 left \r",
      " [ 408 / 500 ]  82% - 0:00:00 left \r",
      " [ 409 / 500 ]  82% - 0:00:00 left \r",
      " [ 410 / 500 ]  82% - 0:00:00 left \r",
      " [ 411 / 500 ]  82% - 0:00:00 left \r",
      " [ 412 / 500 ]  82% - 0:00:00 left \r",
      " [ 413 / 500 ]  83% - 0:00:00 left \r",
      " [ 414 / 500 ]  83% - 0:00:00 left \r",
      " [ 415 / 500 ]  83% - 0:00:00 left \r",
      " [ 416 / 500 ]  83% - 0:00:00 left \r",
      " [ 417 / 500 ]  83% - 0:00:00 left \r",
      " [ 418 / 500 ]  84% - 0:00:00 left \r",
      " [ 419 / 500 ]  84% - 0:00:00 left \r",
      " [ 420 / 500 ]  84% - 0:00:00 left \r",
      " [ 421 / 500 ]  84% - 0:00:00 left \r",
      " [ 422 / 500 ]  84% - 0:00:00 left \r",
      " [ 423 / 500 ]  85% - 0:00:00 left \r",
      " [ 424 / 500 ]  85% - 0:00:00 left \r",
      " [ 425 / 500 ]  85% - 0:00:00 left \r",
      " [ 426 / 500 ]  85% - 0:00:00 left \r",
      " [ 427 / 500 ]  85% - 0:00:00 left \r",
      " [ 428 / 500 ]  86% - 0:00:00 left \r",
      " [ 429 / 500 ]  86% - 0:00:00 left \r",
      " [ 430 / 500 ]  86% - 0:00:00 left \r",
      " [ 431 / 500 ]  86% - 0:00:00 left \r",
      " [ 432 / 500 ]  86% - 0:00:00 left \r",
      " [ 433 / 500 ]  87% - 0:00:00 left \r",
      " [ 434 / 500 ]  87% - 0:00:00 left \r",
      " [ 435 / 500 ]  87% - 0:00:00 left \r",
      " [ 436 / 500 ]  87% - 0:00:00 left \r",
      " [ 437 / 500 ]  87% - 0:00:00 left \r",
      " [ 438 / 500 ]  88% - 0:00:00 left \r",
      " [ 439 / 500 ]  88% - 0:00:00 left \r",
      " [ 440 / 500 ]  88% - 0:00:00 left \r",
      " [ 441 / 500 ]  88% - 0:00:00 left \r",
      " [ 442 / 500 ]  88% - 0:00:00 left \r",
      " [ 443 / 500 ]  89% - 0:00:00 left \r",
      " [ 444 / 500 ]  89% - 0:00:00 left \r",
      " [ 445 / 500 ]  89% - 0:00:00 left \r",
      " [ 446 / 500 ]  89% - 0:00:00 left \r",
      " [ 447 / 500 ]  89% - 0:00:00 left \r",
      " [ 448 / 500 ]  90% - 0:00:00 left \r",
      " [ 449 / 500 ]  90% - 0:00:00 left \r",
      " [ 450 / 500 ]  90% - 0:00:00 left \r",
      " [ 451 / 500 ]  90% - 0:00:00 left \r",
      " [ 452 / 500 ]  90% - 0:00:00 left \r",
      " [ 453 / 500 ]  91% - 0:00:00 left \r",
      " [ 454 / 500 ]  91% - 0:00:00 left \r",
      " [ 455 / 500 ]  91% - 0:00:00 left \r",
      " [ 456 / 500 ]  91% - 0:00:00 left \r",
      " [ 457 / 500 ]  91% - 0:00:00 left \r",
      " [ 458 / 500 ]  92% - 0:00:00 left \r",
      " [ 459 / 500 ]  92% - 0:00:00 left \r",
      " [ 460 / 500 ]  92% - 0:00:00 left \r",
      " [ 461 / 500 ]  92% - 0:00:00 left \r",
      " [ 462 / 500 ]  92% - 0:00:00 left \r",
      " [ 463 / 500 ]  93% - 0:00:00 left \r",
      " [ 464 / 500 ]  93% - 0:00:00 left \r",
      " [ 465 / 500 ]  93% - 0:00:00 left \r",
      " [ 466 / 500 ]  93% - 0:00:00 left \r",
      " [ 467 / 500 ]  93% - 0:00:00 left \r",
      " [ 468 / 500 ]  94% - 0:00:00 left \r",
      " [ 469 / 500 ]  94% - 0:00:00 left \r",
      " [ 470 / 500 ]  94% - 0:00:00 left \r",
      " [ 471 / 500 ]  94% - 0:00:00 left \r",
      " [ 472 / 500 ]  94% - 0:00:00 left \r",
      " [ 473 / 500 ]  95% - 0:00:00 left \r",
      " [ 474 / 500 ]  95% - 0:00:00 left \r",
      " [ 475 / 500 ]  95% - 0:00:00 left \r",
      " [ 476 / 500 ]  95% - 0:00:00 left \r",
      " [ 477 / 500 ]  95% - 0:00:00 left \r",
      " [ 478 / 500 ]  96% - 0:00:00 left \r",
      " [ 479 / 500 ]  96% - 0:00:00 left \r",
      " [ 480 / 500 ]  96% - 0:00:00 left \r",
      " [ 481 / 500 ]  96% - 0:00:00 left \r",
      " [ 482 / 500 ]  96% - 0:00:00 left \r",
      " [ 483 / 500 ]  97% - 0:00:00 left \r",
      " [ 484 / 500 ]  97% - 0:00:00 left \r",
      " [ 485 / 500 ]  97% - 0:00:00 left \r",
      " [ 486 / 500 ]  97% - 0:00:00 left \r",
      " [ 487 / 500 ]  97% - 0:00:00 left \r",
      " [ 488 / 500 ]  98% - 0:00:00 left \r",
      " [ 489 / 500 ]  98% - 0:00:00 left \r",
      " [ 490 / 500 ]  98% - 0:00:00 left \r",
      " [ 491 / 500 ]  98% - 0:00:00 left \r",
      " [ 492 / 500 ]  98% - 0:00:00 left \r",
      " [ 493 / 500 ]  99% - 0:00:00 left \r",
      " [ 494 / 500 ]  99% - 0:00:00 left \r",
      " [ 495 / 500 ]  99% - 0:00:00 left \r",
      " [ 496 / 500 ]  99% - 0:00:00 left \r",
      " [ 497 / 500 ]  99% - 0:00:00 left \r",
      " [ 498 / 500 ] 100% - 0:00:00 left \r",
      " [ 499 / 500 ] 100% - 0:00:00 left \r",
      " [ 500 / 500 ] 100% - 0:00:00 left \n",
      " quantization error: 1.7112551617934335e-05\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<matplotlib.image.AxesImage at 0x1126cef10>"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAPsAAAD5CAYAAADhukOtAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8li6FKAAAQUElEQVR4nO3db4xc5XXH8d/Z8WJjDMH/MC44ceIQKYgopllZFUEpFJESigpUhcZEyG0RTtsgBSUviuiL8NKqAhEvApIprp2KEFCA4ko0DaGJUNIKvCAXzBqIg01tx/hPsVn/wV7vzOmLuVSLu88zy/y5d7zn+5FWnr1n773Hd/e3d2aevc81dxeA6W+g6gYAlIOwA0EQdiAIwg4EQdiBIAg7EMSMTlY2s2sk3S+pJukf3H1N7usXLDBfurSTPXZXq1HH7dvTtUOH2t9uHJauDM5K1gYXXtzOJiFp/OAO1Y8emPQotR12M6tJ+r6kqyXtkrTJzDa6+0hqnaVLpU2b2t1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/euq3fv5Ppa/ZAZSn6jM7gJJUEnYzu8bM3jCzbWZ2VxU9nNLPDjN71cw2m9lwRT2sM7N9ZrZlwrJ5Zvasmf26+Hduxf3cY2a7i+O02cyuLbGfJWb2czMbMbPXzOybxfJKjlGmn8qOUSulP403s5qkNyVdLWmXpE2SVrr7SKmNfLinHZKG3L2y8VEz+5KkI5J+4O6XFMv+XtK77r6m+KU4193/tsJ+7pF0xN2/W0YPp/SzWNJid3/ZzM6W9JKkGyT9uSo4Rpl+blZFx6iVKs7sKyRtc/e33H1M0o8kXV9BH33F3Z+X9O4pi6+XtKF4vEHNH6Yq+6mMu+9x95eLx4clbZV0gSo6Rpl++lYVYb9A0sTZ+nep+oPkkn5qZi+Z2eqKe5lokbvvKR6/I2lRlc0U7jCzV4qn+aW9rJjIzJZKulTSC+qDY3RKP1IfHKPJ8AZd0+Xu/ruSviLpG8VT2L7izddbVQ+dPChpmaTlkvZIurfsBsxsjqQnJN3p7qMTa1Uco0n6qfwYpVQR9t2Slkz4/MJiWWXcfXfx7z5JT6n5UqMf7C1eG37wGnFflc24+153r7t7Q9JDKvk4mdmgmsF6xN2fLBZXdowm66fqY5RTRdg3SbrIzD5pZmdI+qqkjRX0IUkys7OKN1hkZmdJ+rKkLfm1SrNR0qri8SpJT1fYywdh+sCNKvE4mZlJeljSVne/b0KpkmOU6qfKY9SSu5f+IelaNd+R/42kv6uihwm9fErSfxUfr1XVj6RH1Xzad1LN9zFukzRf0nOSfi3pZ5LmVdzPP0l6VdIraoZscYn9XK7mU/RXJG0uPq6t6hhl+qnsGLX64C/ogCB4gw4IgrADQRB2IAjCDgRB2IEgCDsQBGEHgiDsQBD/CwgJwg23l5XXAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "som = MiniSom(30, 30, 3, sigma=8., \n",
    "              learning_rate=.5, \n",
    "              neighborhood_function='bubble')\n",
    "som.train_random(colors, 500, verbose=True)\n",
    "\n",
    "plt.imshow(abs(som.get_weights()), interpolation='none')"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
